﻿using System;
using ExcellentCRM.DataService.IServices;
using ExcellentCRM.DataService.Implements;
using ExcellentCRM.DataService.Models;

namespace ExcellentCRM.DataService
{
    public sealed class ServiceFactory
    {
        #region Serivces

        private readonly Lazy<IBaseService<Menu>> _lazyMenuService =
            new Lazy<IBaseService<Menu>>(() => new BaseService<Menu>());
        public IBaseService<Menu> MenuService
        {
            get { return _lazyMenuService.Value; }
        }

        private readonly Lazy<IBaseService<Role>> _lazyRoleService =
            new Lazy<IBaseService<Role>>(() => new BaseService<Role>());
        public IBaseService<Role> RoleService
        {
            get { return _lazyRoleService.Value; }
        }

        private readonly Lazy<IBaseService<RoleMenu>> _lazyRoleMenuService =
            new Lazy<IBaseService<RoleMenu>>(() => new BaseService<RoleMenu>());
        public IBaseService<RoleMenu> RoleMenuService
        {
            get { return _lazyRoleMenuService.Value; }
        }

        private readonly Lazy<IBaseService<Department>> _lazyDeptService =
            new Lazy<IBaseService<Department>>(() => new DepartmentService());
        public DepartmentService DeptService
        {
            get { return _lazyDeptService.Value as DepartmentService; }
        }

        private readonly Lazy<IBaseService<Account>> _lazyAcctService =
            new Lazy<IBaseService<Account>>(() => new AccountService());
        public AccountService AcctService
        {
            get { return _lazyAcctService.Value as AccountService; }
        }

        private readonly Lazy<IBaseService<Staff>> _lazyStaffService =
            new Lazy<IBaseService<Staff>>(() => new BaseService<Staff>());
        public IBaseService<Staff> StaffService
        {
            get { return _lazyStaffService.Value; }
        }

        private readonly Lazy<IBaseService<StuClient>> _lazyStuClientService =
            new Lazy<IBaseService<StuClient>>(() => new StuClientService());
        public StuClientService StuClientService
        {
            get { return _lazyStuClientService.Value as StuClientService; }
        }

        private readonly Lazy<IBaseService<EnterpriseClient>> _lazyEnterpriseClientService =
            new Lazy<IBaseService<EnterpriseClient>>(() => new BaseService<EnterpriseClient>());
        public IBaseService<EnterpriseClient> EnterpriseClientService
        {
            get { return _lazyEnterpriseClientService.Value; }
        } 

        #endregion

    }
}
